#!/bin/bash

echo $1 $2 $3 ' -> echo $essid $mode $ap'

echo ESSID: $1
echo MODE: $2
echo AP: $3

cd /sys/bus/usb/devices/2-0:1.0/power/
echo on > level

#echo SLEEP 10 Seconds
#sleep 10;
#ifconfig wlan1 down
#dhclient -r wlan1
rfkill unblock 1
#ifconfig wlan1 up
#sleep 2;
#ifconfig wlan1 down
iwconfig wlan1 essid $1
iwconfig wlan1 mode $2
ifconfig wlan1 up
#echo Sleeping 3 Seconds
#sleep 3;
dhclient wlan1
echo POWER UP AND CONNECTED TO $1

